﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="listimages.ascx.cs" Inherits="controls_admin_listimages" %>
<div id="content">        
    <!-- new box --> 
    	<div class="box corners shadow">
            <div class="box-header">
                <img src="../images/admin/icon_menu.png" /><h2>HÌNH ẢNH</h2>
                <div class="box-header-ctrls">	
                	<a href="javascript:void(null);" title="" class="close"><!-- --></a>
                </div>
            </div>                
            <div class="box-content" id="contacts-1a">
               <div class="inbox-sf">
                    <asp:TextBox ID="txtTuKhoa" runat="server" onFocus="if(this.value=='Tìm kiếm hình ảnh')this.value='';" onBlur="if(this.value=='')this.value='Tìm kiếm hình ảnh';" value="Tìm kiếm hình ảnh" class="input-1"></asp:TextBox>                    
                    <asp:DropDownList ID="ddlChuDe" runat="server" class="select-1" Width="220">
                    </asp:DropDownList>
                    <asp:Button ID="btnTim" runat="server" class="inbox-sf-search-btn" Text="Tìm" 
                        onclick="btnTim_Click" />
                    <div class="form-msg-good-advanced" runat="server" id="msgSuccess" style="display:none; float:left; margin-left:20px; margin-bottom:20px; width:220px;"></div>
                    <asp:Button ID="btnThem" runat="server" Text="Thêm" 
                        class="inbox-sf-add-btn tip" title="Thêm một hình ảnh mới" 
                        onclick="btnThem_Click" />                                                            
                </div> 
                 <ul class="articles-list-2">                    
                    <!--tes-->
                    <table id="table1" style="width:100%">
                    <asp:Repeater ID="rptDanhSachHinhAnh" runat="server" 
                            onitemcommand="rptDanhSachHinhAnh_ItemCommand">                         
                        <ItemTemplate>                                                                                
                                <li class="art" style="height:180px ;width : 98%">
                                    <div class="articles-left">
                    	                <h2>Tên hình ảnh :<%#Eval("TenFile")%></h2>
                                        <p><a href="<%#"../images/uploads/" + Eval("TenFile")%>" title="Tên hình ảnh :<%#Eval("TenFile")%> " class="pirobox_media3">
                                                <img src="<%#"../images/galleryactions/" + Eval("TenFile")%>" /> 
                                            </a>                                             
                                            <b>Giới thiệu :</b><%#Eval("GioiThieu")%>
                                        </p>
                                    </div>
                                    <ul class="articles-right">
                                        <li><b>Chủ đề: </b> <%#Eval("TenChuDe")%></li>
                                        <li><b>Người đăng: </b> <%#Eval("NguoiDang")%></li>
                                        <li><b>Ngày đăng </b> <%#Eval("NgayDang")%></li>
                                        <li><b>Trạng thái:</b> <%#(Boolean.Parse(Eval("TrangThai").ToString()) == true)?"Đã đăng":"Chờ duyệt"%></li>
                                        <li class="articles-right-ctrls">
                                           <asp:HyperLink ID="hplSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/addimages.aspx?action=edit&info=" + Eval("IdHinh") %>'>Sửa</asp:HyperLink>
                                        <asp:LinkButton ID="hbTrangThai" runat="server" class="edit-contact gradient-btn" title="Thay đổi trạng thái " CommandArgument='<%# Eval("IdHinh")%>' CommandName="statusupdate">Trạng thái</asp:LinkButton>                                        
                                        <asp:LinkButton ID="lbXoa" runat="server" title="Xóa hình ảnh" onclientclick="return confirm('Chắc chắn rằng bạn muốn xóa hình ảnh này?');" class="delete-contact gradient-btn" CommandArgument='<%# Eval("IdHinh")%>' CommandName="xoa">Xóa</asp:LinkButton>                                             
                                        </li>
                                    </ul>
                                </li> 
                        </ItemTemplate>
                        <FooterTemplate></tbody></FooterTemplate>
                    </asp:Repeater>                                            
                </table>
                 <div class="form-msg-warning-advanced" runat="server" id="msgSearch" style="display:none; float:left; margin-left:0px; margin-bottom:20px; width:220px;">Không có kết quả như yêu cầu tìm kiếm!</div>
                <div class="form-msg-warning-advanced" runat="server" id="msgNoRows" style="display:none; float:left; margin-left:0px; margin-bottom:20px; width:200px;">Dữ liệu đang cập nhật...</div></ul>
                <div class="box-bt-bar"> 
                    <ul class="box-nav" style="display:inline-table;" runat="server" id="PhanTrang">
                        <li>
                            <asp:LinkButton ID="lbtnFirst" runat="server" CausesValidation="false" 
                                         CssClass="prev" onclick="lbtnFirst_Click">Đầu</asp:LinkButton>
                        </li>
                        <li>
                            <asp:LinkButton ID="lbtnPrevious" runat="server" CausesValidation="false" 
                                         CssClass="prev" onclick="lbtnPrevious_Click">Trước</asp:LinkButton>
                        </li>
                        <li>
                            <asp:DataList ID="dlPaging" runat="server" RepeatDirection="Horizontal" 
                                OnItemCommand="dlPaging_ItemCommand" 
                                onitemdatabound="dlPaging_ItemDataBound">
                                <ItemTemplate>                                
                                    <asp:LinkButton ID="lnkbtnPaging" runat="server" CssClass="num" 
                                        CommandArgument='<%# Eval("PageIndex") %>' CommandName="Paging" 
                                        Text='<%# Eval("PageText") %>'></asp:LinkButton>                                
                                </ItemTemplate>
                            </asp:DataList>
                        </li>                        
                        <li>
                            <asp:LinkButton ID="lbtnNext" runat="server" CausesValidation="false" 
                                         CssClass="next" onclick="lbtnNext_Click">Tiếp</asp:LinkButton>
                        </li>
                        <li>
                            <asp:LinkButton ID="lbtnLast" runat="server" CssClass="next" 
                                CausesValidation="false" onclick="lbtnLast_Click" 
                                        >Cuối</asp:LinkButton>
                        </li>                        
                        <asp:Label ID="lblPageInfo" runat="server" Visible="false"></asp:Label>
                    </ul>
                    <%--<ul class="box-nav" runat="server" id="Ul1">
                        <li><a href="#" title="" class="prev">Trước</a></li>
                        <li><a href="#" title="" class="active">1</a></li>
                        <li><a href="#" title="" class="num">2</a></li>
                        <li><a href="#" title="" class="num">3</a></li>

                        <li><a href="#" title="" class="num">4</a></li>
                        <li><a href="#" title="" class="num">..</a></li>
                        <li><a href="#" title="" class="next">Sau</a></li>
                    </ul>--%>
                    <div class="bulk-actions">
                        <%--<select name="field-13" class="select-1">
                            <option value="">Chọn thao tác</option>
                            <option value="">Sửa</option>
                            <option value="">Xóa</option>
                        </select>--%>
                       <%-- <asp:Button ID="btnXoa" runat="server" Text="Xóa" onclick="btnXoa_Click" />--%>
                        <asp:Button ID="btnLamMoi" runat="server" Text="Làm mới" 
                            onclick="btnLamMoi_Click" />                        
                    </div> 
                </div>                 
            </div>
        </div>
</div>
<script type="text/javascript" src="../templates/admin/scripts/checkAll.js"></script>
<script type="text/javascript">
    var rptDanhSachHinhAnhControl = document.getElementById('<%= rptDanhSachHinhAnh.ClientID %>');
    $('input:checkbox[id$=CheckSelectAll]', rptDanhSachHinhAnhControl).click(function(e)
    {
        if (this.checked)
        {
            $('input:checkbox[id$=CheckSelect]', rptDanhSachHinhAnhControl).attr('checked', true);
        }
        else
        {
            $('input:checkbox[id$=CheckSelect]', rptDanhSachHinhAnhControl).removeAttr('checked');
        }
    });
   
    $('input:checkbox[id$=CheckSelect]', rptDanhSachHinhAnhControl).click(function(e)
    {
        //Bo checkall
        if ($('input:checkbox[id$=CheckSelect]:checked', rptDanhSachHinhAnhControl).length == 0)
        {
            $('input:checkbox[id$=CheckSelectAll]', rptDanhSachHinhAnhControl).removeAttr('checked');
        }
        // Checkall
        else if ($('input:checkbox[id$=CheckSelect]:checked', rptDanhSachHinhAnhControl).length == $('input:checkbox[id$=CheckSelect]', rptDanhSachHinhAnhControl).length)
        {
            $('input:checkbox[id$=CheckSelectAll]', rptDanhSachHinhAnhControl).attr('checked', true);
        }
    });

</script>
